
class MyValue{
    int val;
}

public class test {

    public static void swap(MyValue v1,MyValue v2){
        int temp=v1.val;
        v1.val=v2.val;
        v2.val=temp;
    }

    public static void main(String[] args) {
        MyValue myValue1=new MyValue();
        MyValue myValue2=new MyValue();
        myValue1.val=10;
        myValue2.val=20;
        System.out.println("排序前:"+myValue1.val+" "+myValue2.val);
        swap(myValue1,myValue2);
        System.out.println("排序后:"+myValue1.val+" "+myValue2.val);
    }
}
